<?phpclass MAPI_AlloCine {    private $_api_url = "http://api.allocine.fr/rest/v3";    private $_api_code = "aXBhZC12MQ";    private $_url_proxy = '';
        public function searchForMovies($query) {        $url = $this->_api_url . "/search?";        $url .= "partner=" . $this->_api_code;        $url .= "&filter=movie";        $url .= "&count=10";        $url .= "&format=json";        $url .= "&q=" . urlencode($query);        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);        if ($this->_url_proxy != '')
	        curl_setopt($ch, CURLOPT_PROXY, $this->_url_proxy); // '192.168.47.251:3128'
        $data = curl_exec($ch);
        curl_close($ch);        
        $raw_array = json_decode($data, true);
//         $raw_array = json_decode(file_get_contents($url), true);        $raw_array = $raw_array["feed"]["movie"];        //print_r($raw_array);die;        //var $new_array;        foreach ($raw_array as $item) {            $current['title'] = (isset($item['title']) ? $item['title'] : $item['originalTitle']);            $current['api_id'] = $item['code'];            $new_array['movies'][] = $current;        }        return $new_array;    }    public function getDetails($code) {        $url = $this->_api_url . "/movie?";        $url .= "partner=" . $this->_api_code;        $url .= "&format=json";        $url .= "&code=" . urlencode($code);                $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);        if ($this->_url_proxy != '')	        curl_setopt($ch, CURLOPT_PROXY, $this->_url_proxy); // '192.168.47.251:3128'        $data = curl_exec($ch);
        curl_close($ch);        
        $raw_array = json_decode($data, true);
//         $raw_array = json_decode(file_get_contents($url), true);        if(isset($raw_array["movie"]))            return $raw_array["movie"];        return array();            }        public function useProxy($url) {    	$this->_url_proxy = $url;    }}//{"feed"://	{"page":1,//	"count":10,//	"results":[//		{"type":"movie","$":2}//	],//	"totalResults":2,//	"movie":[{"code":51013,"originalTitle":"Batman Begins","productionYear":2005,"release":{"releaseDate":"2005-06-15"},"castingShort":{"directors":"Christopher Nolan","actors":"Christian Bale, Katie Holmes, Michael Caine, Cillian Murphy, Liam Neeson"},"statistics":{"pressRating":3.66667,"userRating":4.04472},"poster":{"path":"\/medias\/nmedia\/18\/35\/23\/40\/18431141.jpg","href":"http:\/\/images.allocine.fr\/medias\/nmedia\/18\/35\/23\/40\/18431141.jpg"},"link":[{"rel":"aco:web","href":"http:\/\/www.allocine.fr\/film\/fichefilm_gen_cfilm=51013.html"}]},{"code":115362,"originalTitle":"The Dark Knight","title":"The Dark Knight, Le Chevalier Noir","productionYear":2008,"release":{"releaseDate":"2008-08-13"},"castingShort":{"directors":"Christopher Nolan","actors":"Christian Bale, Heath Ledger, Aaron Eckhart, Maggie Gyllenhaal, Michael Caine"},"statistics":{"pressRating":4,"userRating":4.50133},"poster":{"path":"\/medias\/nmedia\/18\/63\/97\/89\/18949761.jpg","href":"http:\/\/images.allocine.fr\/medias\/nmedia\/18\/63\/97\/89\/18949761.jpg"},"link":[{"rel":"aco:web","href":"http:\/\/www.allocine.fr\/film\/fichefilm_gen_cfilm=115362.html"}]}]}}null